package com.smart.security.starter.model;

import lombok.Getter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;

/**
 * 扩展用户信息
 *
 * @author guxiaobai
 * @date 2018/12/7 16:06
 */
public class SmartUser extends User {
    /**
     * 用户ID
     */
    @Getter
    private Long id;
    /**
     * 部门ID
     */
    @Getter
    private Long deptId;

    /**
     * 组装用户信息
     *
     * @param id
     * @param deptId
     * @param username
     * @param password
     * @param enabled
     * @param accountNonExpired
     * @param credentialsNonExpired
     * @param accountNonLocked
     * @param authorities
     */
    public SmartUser(Long id, Long deptId, String username, String password, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities) {
        super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
        this.id = id;
        this.deptId = deptId;
    }
}
